#include <iostream>
#include "builder2.h"

void builder2::Phone::set_camera(std::string camera)
{
	m_camera = camera;
}

void builder2::Phone::set_screen(std::string screen)
{
	m_screen = screen;
}

void builder2::Phone::set_battery(std::string battery)
{
	m_battery = battery;
}

void builder2::Phone::display_camera()
{
	std::cout << m_camera << std::endl;
}

void builder2::Phone::display_battery()
{
	std::cout << m_battery << std::endl;
}

void builder2::Phone::display_screen()
{
	std::cout << m_screen << std::endl;
}


builder2::Phone* builder2::IBuilder::get_phone()
{
	return phone;
}

//xiaomiBuilder
builder2::XiaomiBuilder::XiaomiBuilder()
{
	phone = new builder2::Phone;
}

void builder2::XiaomiBuilder::build_camera()
{
	phone->set_camera("xiaomi camera created!");
}

void builder2::XiaomiBuilder::build_battery()
{
	phone->set_battery("xiaomi battery created!");
}

void builder2::XiaomiBuilder::build_screen()
{
	phone->set_screen("xiaomi screen created!");
}

//HuaweiBuilder
builder2::IPhoneBuilder::IPhoneBuilder()
{
	phone = new Phone;
}

void builder2::IPhoneBuilder::build_camera()
{
	phone->set_camera("iphone camera created!");
}

void builder2::IPhoneBuilder::build_battery()
{
	phone->set_battery("iphone battery created!");
}

void builder2::IPhoneBuilder::build_screen()
{
	phone->set_screen("iphone screen created!");
}


builder2::Director::Director(builder2::IBuilder* builder)
	:m_builder(builder)
{
}

void builder2::Director::create(builder2::IBuilder* builedr)
{
	builedr->build_screen();
	builedr->build_battery();
	builedr->build_camera();
}

void builder2::Director::create()
{
	m_builder->build_screen();
	m_builder->build_battery();
	m_builder->build_camera();
}
